package com.issue.system.service.impl;

import java.util.List;
import com.issue.common.utils.DateUtils;
import com.issue.common.utils.SecurityUtils;
import com.issue.common.utils.StringUtils;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.issue.system.mapper.ChildAssignmentMapper;
import com.issue.system.domain.ChildAssignment;
import com.issue.system.service.IChildAssignmentService;

/**
 * AssignmentService业务层处理
 * 
 * @author system
 * @date 2024-10-20
 */
@Service
public class ChildAssignmentServiceImpl implements IChildAssignmentService 
{
    @Autowired
    private ChildAssignmentMapper childAssignmentMapper;

    /**
     * 查询Assignment
     * 
     * @param id Assignment主键
     * @return Assignment
     */
    @Override
    public ChildAssignment selectChildAssignmentById(Long id)
    {
        return childAssignmentMapper.selectChildAssignmentById(id);
    }

    /**
     * 查询Assignment列表
     * 
     * @param childAssignment Assignment
     * @return Assignment
     */
    @Override
    public List<ChildAssignment> selectChildAssignmentList(ChildAssignment childAssignment)
    {
        return childAssignmentMapper.selectChildAssignmentList(childAssignment);
    }

    /**
     * 新增Assignment
     * 
     * @param childAssignment Assignment
     * @return 结果
     */
    @Override
    public int insertChildAssignment(ChildAssignment childAssignment)
    {
        childAssignment.setCreateTime(DateUtils.getNowDate());
        if (StringUtils.isNotEmpty(SecurityUtils.getUsername())) {
            childAssignment.setCreateBy(SecurityUtils.getUsername());
        }
        return childAssignmentMapper.insertChildAssignment(childAssignment);
    }

    /**
     * 修改Assignment
     * 
     * @param childAssignment Assignment
     * @return 结果
     */
    @Override
    public int updateChildAssignment(ChildAssignment childAssignment)
    {
        childAssignment.setUpdateTime(DateUtils.getNowDate());
        childAssignment.setUpdateBy(SecurityUtils.getUsername());
        return childAssignmentMapper.updateChildAssignment(childAssignment);
    }

    /**
     * 批量删除Assignment
     * 
     * @param ids 需要删除的Assignment主键
     * @return 结果
     */
    @Override
    public int deleteChildAssignmentByIds(Long[] ids)
    {
        return childAssignmentMapper.deleteChildAssignmentByIds(ids);
    }

    /**
     * 删除Assignment信息
     * 
     * @param id Assignment主键
     * @return 结果
     */
    @Override
    public int deleteChildAssignmentById(Long id)
    {
        return childAssignmentMapper.deleteChildAssignmentById(id);
    }
}
